<template>
  <div class="dance-music-mvs">
    <div class="dance_list">
      <div
        class="list_one"
        v-for="(item, index) in mvList"
        :key="index"
        @mouseenter="handleEnter(index)"
        @mouseleave="handleLeave(index)"
        @click="turnDetail(item)"
      >
        <div class="playcount">
          <i class="iconfont icon-shipin"></i>
          <span>{{ parseInt(item.playCount / 10000) + '万' }}</span>
        </div>
        <img v-lazy="item.cover || item.imgurl" alt="" />
        <transition name="fade">
          <div class="play" v-show="currentIndex == index">
            <i class="iconfont icon-icon_play"></i>
          </div>
        </transition>

        <div class="mv_name">
          <p>{{ item.name }}</p>
          <span>{{ item.artistName }}</span>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      currentIndex: null
    }
  },
  methods: {
    handleEnter (index) {
      this.currentIndex = index
    },
    handleLeave (index) {
      this.currentIndex = null
    },
    turnDetail (item) {
      // 跳转mv详情
      this.$router.push({
        name: 'mvdetail',
        params: {
          id: item.id
        }
      })
    }
  },
  props: {
    mvList: {
      type: Array,
      default: []
    }
  }
}
</script>
<style lang="less">
.dance-music-mvs {
  width: 100%;
  font-size: 13px;
}
.dance_list {
  display: flex;
  flex-wrap: wrap;
  .list_one {
    width: calc(100% / 4);
    padding: 5px 20px;
    cursor: pointer;
    height: 300px;
    position: relative;
    img {
      width: 100%;
      height: 200px;
    }
    .playcount {
      position: absolute;
      width: 60px;
      right: 20px;
      top: 20px;
      display: flex;
      color: white;
    }
    .play {
      width: 50px;
      height: 50px;
      font-size: 50px;
      line-height: 40px;
      text-align: center;
      border: 1px solid red;
      color: red;
      border-radius: 50%;
      position: absolute;
      left: 0;
      top: -10%;
      right: 0;
      bottom: 0;
      margin: auto;
      i {
        font-size: 40px;
      }
    }
  }
  .mv_name {
    p {
      color: #000;
      font-size: 20px;
    }
    span {
      font-size: 16px;
      color: #ccc;
    }
  }
}
.fade-enter-active {
  opacity: 1;
  transition: all 0.5s;
}
.fade-leave-active {
  opacity: 0;
  transition: all 0.5s;
}
</style>
